package com.hducms.cms.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hducms.cms.dao.ChannelDao;
import com.hducms.cms.service.ChannelDeleteChecker;

@Service
@Transactional
public class ChannelDeleteCheckerImpl implements ChannelDeleteChecker {

	@Override
	public String checkForChannelDelete(Integer channelId) {
		int count = dao.countByChannelId(channelId);
		if (count > 0) {
			return "content.error.cannotDeleteChannel";
		} else {
			return null;
		}
	}
	private ChannelDao dao;
	@Autowired
	public void setDao(ChannelDao dao) {
		this.dao = dao;
	}
}
